<?php

namespace app\models\jasper;

trait JasperApiAlertTrait
{
    /**
     * @param integer $since
     * @param boolean $sinceSpecified
     * @return \stdClass
     * @throws \Exception
     */
    public function GetAlerts($since, $sinceSpecified)
    {
        return $this->call(
            preg_replace('/.*JasperApi(.*?)Trait/', '$1', __TRAIT__),
            __FUNCTION__,
            [
                'since' => date('c', $since),
                'sinceSpecified' => $sinceSpecified,
            ]
        );
    }

    /**
     * @param int[] $alertIds
     * @return \stdClass
     * @throws \Exception
     */
    public function GetAlertDetails($alertIds)
    {
        return $this->call(
            preg_replace('/.*JasperApi(.*?)Trait/', '$1', __TRAIT__),
            __FUNCTION__,
            [
                'alertIds' => $alertIds,
            ]
        );
    }
}
